using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PRDETAILMap : EntityTypeConfiguration<SO_PRDETAIL>
    {
        public SO_PRDETAILMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ORDER__, t.SUMFIELDS, t.DimFIELDS });

            // Properties
            this.Property(t => t.ORDER__)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.ID)
                .HasMaxLength(7);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.BARCODE)
                .HasMaxLength(15);

            this.Property(t => t.DESCRIPTION)
                .HasMaxLength(250);

            this.Property(t => t.LOCATION)
                .HasMaxLength(3);

            this.Property(t => t.CATEGORY)
                .HasMaxLength(50);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.DimFIELDS)
                .IsRequired()
                .HasMaxLength(24);

            // Table & Column Mappings
            this.ToTable("SO_PRDETAIL");
            this.Property(t => t.ORDER__).HasColumnName("ORDER_#");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Quantity_REMAINING).HasColumnName("Quantity_REMAINING");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.BARCODE).HasColumnName("BARCODE");
            this.Property(t => t.DESCRIPTION).HasColumnName("DESCRIPTION");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.QTY).HasColumnName("QTY");
            this.Property(t => t.expiry_date).HasColumnName("expiry_date");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.INITIAL_FOB_COST).HasColumnName("INITIAL_FOB_COST");
            this.Property(t => t.DISCOUNT).HasColumnName("DISCOUNT");
            this.Property(t => t.DISCOUNT_PERCENT).HasColumnName("DISCOUNT_PERCENT");
            this.Property(t => t.FOB_COST).HasColumnName("FOB_COST");
            this.Property(t => t.EXTEND).HasColumnName("EXTEND");
            this.Property(t => t.LANDED_COST).HasColumnName("LANDED_COST");
            this.Property(t => t.LANDed_Extended).HasColumnName("LANDed_Extended");
            this.Property(t => t.LINE_TAX).HasColumnName("LINE_TAX");
            this.Property(t => t.CATEGORY).HasColumnName("CATEGORY");
            this.Property(t => t.retail_price).HasColumnName("retail_price");
            this.Property(t => t.Whole_price).HasColumnName("Whole_price");
            this.Property(t => t.FIXED_ASSET).HasColumnName("FIXED_ASSET");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DimFIELDS).HasColumnName("DimFIELDS");
        }
    }
}
